package com.util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Date;

import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;

public class PdfGenerator {

	public OutputStream generatePDF(String destinationPath)
	{
		try {
            OutputStream file = new FileOutputStream(new File(destinationPath));
 
             Document document_new = new Document();
             PdfWriter.getInstance(document_new, file);
             document_new.open();
             document_new.add(new Paragraph("Hello World, iText"));
             document_new.add(new Paragraph(new Date().toString()));
             document_new.close();
           
            file.close();
            return file;
        } catch (Exception e) {
 
            e.printStackTrace();
            return null;
        }
	}
}
